package com.metaera.app.controller.presenter;

import com.metaera.app.controller.core.RequestPresenter;
import com.metaera.app.controller.view.core.INetworkRequestView;
import com.metaera.app.data.DataRepository;
import com.metaera.app.data.model.ArticleListResponse;
import com.metaera.app.data.rx.ResponseObserver;
import com.metaera.app.data.rx.SchedulersTransformer;

import java.util.List;

public class ArticleRecommendPresenter extends RequestPresenter<INetworkRequestView<List<ArticleListResponse>>> {

    public void execute(int id){
        DataRepository.getInstance()
                .relatedRecommend(String.valueOf(id))
                .compose(SchedulersTransformer.transformer())
                .subscribe(new ResponseObserver<>(
                                this,
                                mView,
                                response -> mView.successful(response.getData())
                        )
                );
    }

}
